package org.xiji.menmentopattern;

/**
 * 用户状态源发器
 */
public class UserInfoOriginator  {

    private String userState;

    /**
     *
     * 获取用户状态
     */
    public String getUserState() {
        return userState;
    }

    /**
     * 设置用户状态
     */

    public void setUserState(String userState) {
        this.userState = userState;
    }

    /**
     * 保存用户当前状态===>保存为备忘录对象
     */
    public UserInfoMemento saveStateToMemento(){
        return new UserInfoMemento(this.userState);

    }
    /**
     * 通过备忘录对象恢复用户的某一时刻
     */
    public void recoveryUserInfoState(UserInfoMemento userInfoMemento){
        this.userState = userInfoMemento.getState();

    }



}
